package com.springboot.wisdom.user.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseService;
import com.springboot.wisdom.common.common.bean.DeleteDTO;
import com.springboot.wisdom.common.common.bean.MyResult;
import com.springboot.wisdom.common.common.bean.PageQueryDTO;
import com.springboot.wisdom.serviceApi.user.model.dto.UserInfoDTO;
import com.springboot.wisdom.serviceApi.user.model.entity.UserDO;
import com.springboot.wisdom.serviceApi.user.model.vo.LoginUserVO;
import com.springboot.wisdom.serviceApi.user.model.vo.RegisterUserVO;
import com.springboot.wisdom.serviceApi.user.model.vo.UserTokenInfo;
import com.springboot.wisdom.serviceApi.user.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;

public interface UserService extends MPJBaseService<UserDO> {

    MyResult<UserTokenInfo> userPassLogin(LoginUserVO loginData, HttpServletRequest request);

    MyResult<UserInfoDTO> register(RegisterUserVO registerUserVO, HttpServletRequest request);

    MyResult<String> logout(HttpServletRequest request);


    MyResult<Page<UserVO>> getInfoPageBy(PageQueryDTO pageQueryDTO, UserVO userVO);

    MyResult<String> rePassword(String id, HttpServletRequest request);

    MyResult<String> setStatus(String id, HttpServletRequest request);

    MyResult<String> deleteInfo(String id, HttpServletRequest request);


    // 是否存在指定邮箱，
    Boolean isEmail(String email);


    MyResult<String> addInfo(UserVO userVO);

    MyResult<String> delInfo(String userId);

    MyResult<String> delInfo(DeleteDTO<String> deleteIds);


    MyResult<IPage<UserVO>> getUserInfoPageBy(PageQueryDTO pageQueryDTO, UserVO userVO);

    MyResult<UserVO> getUserById(String userId);

    MyResult<UserVO> getUserByUsername(String username);


    MyResult<String> changeInfo(UserVO userVO);

    MyResult<String> changeName(String userId, String name);

    // 修改密码
    MyResult<String> changePassword(String userId, String oldPassword, String newPassword);

    // 修改电子邮箱。
    MyResult<String> editEmail(String oldEmail, String oldCode, String newEmail, String newCode);

    // 修改手机号
    MyResult<String> changePhone(String userId, String newPhone);

    MyResult<String> changeAvatarUrl(String userId, String avatarUrl);
}